package com.extract.rar;

import java.io.File;
import java.util.Scanner;

/**
 * 孙敬佳
 * 2023 \ 07 \ 26
 */

public class MyMain {
    public static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) throws Exception {
        System.out.println("原文件路径：D:\\下载\\补丁。1、确定 2、输入");
        StringBuilder sourceFilePath = new StringBuilder();
        if (scanner.nextInt() == 1) {
            sourceFilePath.append("D:\\下载\\补丁\\");
            System.out.print("文件名称：");
            sourceFilePath.append(scanner.next());
        } else {
            System.out.print("文件路径及名称：");
            sourceFilePath.append(scanner.next());
        }
        File f = new File(sourceFilePath.toString());
        StringBuilder targetFilePath = new StringBuilder();
        System.out.println("目标文件路径：D:\\下载\\补丁。1、确定 2、输入");
        if (scanner.nextInt() == 1) {
            targetFilePath.append("D:\\下载\\补丁\\");
            System.out.print("解压后文件夹名称：");
            targetFilePath.append(scanner.next());
        } else {
            System.out.print("文件解压后存储路径：");
            targetFilePath.append(scanner.next());
        }
//        String newTargetFilePath = targetFilePath + "\\" + sourceFilePath.substring(sourceFilePath.lastIndexOf("\\") + 1, sourceFilePath.length() - 4);
        System.out.println("解压到：" + targetFilePath);
        System.out.print("\n解压中。。。");
        ExtractRAR.uncompressAllFile(f, targetFilePath.toString());
    }
}